<template>
	<div class="city">
		<city-header></city-header>
		<city-search></city-search>
		<city-hot :hotCities="hotCities"></city-hot>
		<city-a :A="A"></city-a>
	</div>
</template>

<script>
	import CityHeader from './components/Header'
	import CitySearch from './components/Search'
	import CityHot from './components/Hot'
	import CityA from './components/A'
	import CityB from './components/B'
	import axios from 'axios'
  export default {
  	name: 'city',
  	data(){
  		return {
  			hotCities: [],
  			A: [],
  			B: []
  		}
  	},
  	components: {
  		CityHeader,
  		CitySearch,
  		CityHot,
  		CityA
  	},
  	methods: {
    getHomeInfo () {
      axios.get('/api/city.json')
        .then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc (res) {
      res = res.data
      if (res.ret && res) {
        const data = res.data
        this.hotCities = data.hotCities
        this.A = data.cities.A
        this.B = data.cities.B
      }
    }
  },
  mounted () {
    this.getHomeInfo()
  }
  }
</script>

<style lang="stylus" scoped>
.city
  background #eee
</style>
